//
//  BCustomerServiceCell.m
//  GSBlockChain
//
//  Created by guoshikeji_a on 2018/12/17.
//  Copyright © 2018 guoshikeji. All rights reserved.
//

#import "BCustomerServiceCell.h"

#import "BCustomerServiceDataModel.h"

@interface BCustomerServiceCell ()

@property (nonatomic, strong) UIImageView *iconIV;

/**
 *nameLabel
 */
@property (nonatomic, strong) QMUILabel *nameLabel;

/**
 *contentLabel
 */
@property (nonatomic, strong) QMUILabel *contentLabel;

@end

@implementation BCustomerServiceCell

- (instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier {
    self = [super initWithStyle:style reuseIdentifier:reuseIdentifier];
    if (self) {
        [self setupSubviews];
    }
    return self;
}
- (void)setupSubviews {
    self.iconIV = [UIImageView new];
    self.iconIV.contentMode = UIViewContentModeScaleAspectFit;
    [self.contentView addSubview:self.iconIV];
    [self.iconIV mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.mas_equalTo(self.contentView).offset(12.0);
        make.centerY.mas_equalTo(self.contentView);
        make.size.mas_equalTo(CGSizeMake(15.0, 15.0));
    }];
    //
    self.nameLabel = [QMUILabel new];
    self.nameLabel.textColor = [UIColor qmui_colorWithHexString:@"#6D6D6D"];
    self.nameLabel.font = [UIFont systemFontOfSize:13 weight:UIFontWeightRegular];
    [self.contentView addSubview:self.nameLabel];
    [self.nameLabel mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.mas_equalTo(self.iconIV.mas_right).offset(2.0);
        make.centerY.mas_equalTo(self.contentView);
        make.width.mas_equalTo(100.0);
    }];
    //
    self.contentLabel = [QMUILabel new];
    self.contentLabel.textColor = [UIColor qmui_colorWithHexString:@"#3C3C3C"];
    self.contentLabel.font = [UIFont systemFontOfSize:15 weight:UIFontWeightRegular];
    [self.contentView addSubview:self.contentLabel];
    //
    [self.contentLabel mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.mas_equalTo(self.nameLabel.mas_right).offset(5.0);
        make.centerY.mas_equalTo(self.contentView);
        make.right.mas_equalTo(self.contentView).offset(-10.0);
    }];
}


- (void)setDataItem:(BCustomerServiceDataItem *)dataItem {
    _dataItem = dataItem;
    //
    [self.iconIV sd_setImageWithURL:[NSURL URLWithString:dataItem.icon]];
    self.nameLabel.text = dataItem.title;
    self.contentLabel.text = dataItem.value;
}

@end
